﻿//https://leetcode.cn/problems/H8086Q/?envType=problem-list-v2&envId=queue

class RecentCounter {
    queue<int> q;
public:
    RecentCounter() {

    }

    int ping(int t) {
        q.push(t);
        while (q.front() < t - 3000)
        {
            q.pop();
        }
        return q.size();

    }
};

/**
 * Your RecentCounter object will be instantiated and called as such:
 * RecentCounter* obj = new RecentCounter();
 * int param_1 = obj->ping(t);
 */